// 1.命令模式定义
// 执行者
class Cooker {
    cook() {
        console.log('厨师开始做饭。。');
    }
}
class Cleaner {
    clean() {
        console.log('阿姨开始做保洁');
    }
}
// 命令对象
class CookCommand {
    constructor(receiver) {
        this.receiver = receiver;
    }
    execute() {
        this.receiver.cook();
    }
}
class CleanCommand {
    constructor(receiver) {
        this.receiver = receiver;
    }
    execute() {
        this.receiver.clean();
    }
}
// 调用者
class Customer {
    constructor(command) {
        this.command = command;
    };
    commandDo() {
        this.command.execute();
    }
}
// 实例测试
let cooker = new Cooker();
let cleaner = new Cleaner();
let cookComand = new CookCommand(cooker);
let cleanComand = new CleanCommand(cleaner);
let customer = new Customer(cookComand);
customer.commandDo();
let customer2 = new Customer(cleanComand);
customer2.commandDo();